//
//  HMNavigationViewController.swift
//  WeiBo
//
//  Created by 李立达 on 15/12/5.
//  Copyright © 2015年 heima11. All rights reserved.
//

import UIKit

class HMNavigationViewController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        
    }

    override func pushViewController(viewController: UIViewController, animated: Bool) {
        
        if(childViewControllers.count != 0)
        {
            var title : String = "返回"
            
            if(childViewControllers.count == 1)
            {
                title = childViewControllers.first?.title ?? title
            }
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(imgName: "navigationbar_back_withtext", title: title, target: self, anction: "back")
            viewController.hidesBottomBarWhenPushed = true
        }
        
        super.pushViewController(viewController, animated: animated)
        
    }

    @objc private func back(){
        popViewControllerAnimated(true)
    }

}
